﻿@using CleanArchitecture.Core.Helper
@using CleanArchitecture.Infrastructure.Models.SystemManage
@model SystemModuleModel
@{
    Layout = "_BackendLayout";
    ViewData["Title"] = ViewBag.PageTitle as string;
}

<div class="systemmodulemanage layui-main">
    <div class="layui-container layui-col-220" style="padding: 0;">
        <div class="layui-nav-custom-title">
            @ViewBag.PageTitle
        </div>
        <div class="layui-row layui-nav-custom-content"></div>
    </div>
    <div id="rightpanel" class="right-col-body">
        <form class="layui-form">
            <fieldset class="layui-elem-field">
                <div class="layui-field-box">
                    <div class="layui-row pagebuttongroup">
                        <div class="sidebar-collaps toolgroup" data-tips="收起侧边栏" data-type="collaps" data-side-fold="1" data-widthelement="layui-col-220" data-leftelement="right-col-body">
                            <i class="fa fa-outdent"></i>
                        </div>
                        @await Component.InvokeAsync("PageButton")
                    </div>
                </div>
            </fieldset>

            <table id="systemmoduletable" lay-filter="systemmoduletable"></table>
        </form>
    </div>
</div>
@await Component.InvokeAsync("RecordButton")
<script type="text/html" id="isActiveTpl">
    <input type="checkbox" value="{{d.IsActive}}" lay-skin="switch" lay-text="ON|OFF" {{ d.IsActive ? 'checked' : '' }}>
</script>
@section scripts{
    <script type="text/javascript">
        var moduletableconfig = {
            elem: "#systemmoduletable",
            url: '/api/system/getsystemmoduletreebyid',
            contentType: 'application/json;charset=UTF-8',
            cols: [[
                { type: "checkbox", width: 50, fixed: "left" },
                { field: 'Id', hide: true, title: 'ID' },
                { field: '@Model.nameof(p => p.ModuleName)', title: '@(ReflectionExtensions.GetPropertyDisplayName<SystemModuleModel>(m => m.ModuleName))' },
                { field: '@Model.nameof(p => p.DisplayName)', title: '@(ReflectionExtensions.GetPropertyDisplayName<SystemModuleModel>(m => m.DisplayName))' },
                { field: '@Model.nameof(p => p.ModuleTypeDisplay)', title: '@(ReflectionExtensions.GetPropertyDisplayName<SystemModuleModel>(m => m.ModuleTypeDisplay))', width: 150 },
                { field: '@Model.nameof(p => p.UrlRoute)', title: '@(ReflectionExtensions.GetPropertyDisplayName<SystemModuleModel>(m => m.UrlRoute))' },
                { field: '@Model.nameof(p => p.ModuleAssignedButtonNames)', title: '@(ReflectionExtensions.GetPropertyDisplayName<SystemModuleModel>(m => m.ModuleAssignedButtonNames))' },
                { field: '@Model.nameof(p => p.DisplayOrder)', title: '@(ReflectionExtensions.GetPropertyDisplayName<SystemModuleModel>(m => m.DisplayOrder))', width: 80 },
                    @*{ field: '@Model.nameof(p => p.IsActive)', title: '@(ReflectionExtensions.GetPropertyDisplayName<SystemModuleModel>(m => m.IsActive))', templet: '#isActiveTpl', width: 120 },*@
                { title: '操作', minWidth: 100, templet: '#tableitemBars', fixed: "right", align: "center" }
            ]],
            parseData: function (res) {
                return {
                    "code": res.state == 200 ? 0 : -1,     //解析接口状态
                    "msg": res.message,     //解析提示文本
                    "data": res.data   //解析数据列表
                };
            }
        };
    </script>
    <script src="~/js/backend/systemmanage/systemmodulemanage.min.js" charset="utf-8" asp-append-version="true"></script>
}
